<?php
 $link = mysql_connect('localhost', 'kootenay', 'nonsense');
 if (!$link) {
  die ('Not connected : ' . mysql_error());
 }
 $db_selected = mysql_select_db('kootenay', $link);

 if (!$db_selected) {
  die ('Can\'t use foo : ' . mysql_error());
 }
 

?>




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="css/inventory.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>KCR Playbox <?php echo date("F d, Y"); ?></title>
</head>

<body>
<h1>KCR Playbox <?php echo date("F d, Y"); ?></h1>
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td class="tdH"><strong></strong></td>
    <td class="tdH"><strong>M</strong></td>
    <td class="tdH"><strong>Section</strong></td>
    <td class="tdH"><strong>Artist</strong></td>
    <td class="tdH"><strong>Title</strong></td>
    <td class="tdH"><strong>Label</strong></td>
  </tr>
  
<?php   
 
$query = '
select
 medium_label, section_label, artist, title, company_name
 from ml_albums a
 left join ml_sections s on a.section_id = s.section_id
 left join ml_media m on a.medium_id = m.medium_id
 left join ml_labels l on a.label_id = l.label_id
 where superseded_by is null
  and playbox_p = "P"
 order by medium_label, section_label, artist, title
';

$result= mysql_query($query);
while ($row = mysql_fetch_array($result) )
{
$x++;
if ($x == 80) 
{ 
echo '<tr>
	<td class="tdH"><strong></strong></td>
    <td class="tdH"><strong>M</strong></td>
    <td class="tdH"><strong>Section</strong></td>
    <td class="tdH"><strong>Artist</strong></td>
    <td class="tdH"><strong>Title</strong></td>
    <td class="tdH"><strong>Label</strong></td>
  </tr>'; $x = 0; 
  }
  
echo " 
  <tr>
  	<td class='td1'>[  ]&nbsp;&nbsp;&nbsp;</td>
    <td class='td1'>".$row[0]."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
    <td class='td1' nowrap='nowrap' >".$row[1]."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
    <td class='td1'>".$row[2]."&nbsp;&nbsp;&nbsp;</td>
    <td class='td1'>".$row[3]."&nbsp;&nbsp;&nbsp;</td>
    <td class='td1'>".$row[4]."&nbsp;&nbsp;&nbsp;</td>
  </tr>
  ";
 } 
?>  
  
</table>
<p>&nbsp;</p>
</body>
</html>
